import {useState} from "react";
import searchIcon from '../../assets/images/search.svg'

function Search() {
  const [searchText, setSearchText] = useState('')

  function changeSearch(val: string) {
    setSearchText(val)
  }

  function handleSearch() {
    console.log(searchText)
  }

  return (
    <div className='search'>
      <input className='input' type='text' onChange={(e) => {
        changeSearch(e.target.value)
      }}/>
      <img className='icon' src={searchIcon} alt='search' onClick={handleSearch}/>
    </div>
  )
}

export default Search
